<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>checkout</title>
	<link rel="stylesheet" href="__PUBLIC__/style/style.css">
	<script type="text/javascript" src="__PUBLIC__/js/jquery.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/main.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/Calculate.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/ajaxChange.js"></script>
</head>
<body style="background:#F5F5F5;">
	<script type="text/javascript" src="__PUBLIC__/js/requ.js"></script>
	<div class="checkout-header">
		<a href="{:U('Index/index')}" class="logo"></a>
		<h1>我的购物车</h1>
		<p>温馨提示：产品是否购买成功，以最终下单为准哦，请尽快结算</p>
		<a href="javascript:;">我的订单</a>
		<ul>
			<a href="javascript:;">464845645</a>
			<li><a href="javascript:;">个人中心</a></li>
			<li><a href="javascript:;">退出登录</a></li>
		</ul>
	</div>	
	<div class="checkout-container">
		<table class="table">
			<thead>
				<tr>
					<th>商品信息</th>
					<th>单价</th>
					<th>数量</th>
					<th>小计</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<foreach name="model" item="mv" key="mk">
					<tr>
						<td>
							<img src="__IMAGE__/{$mv.photourl}{$mv.photoname}" alt="" style="width: 80px;height: 80px">
							<p>{$mv.name}&nbsp;&nbsp;&nbsp;{$mv.content}&nbsp;&nbsp;&nbsp;{$mv.color}</p>
						</td>
						<td>
							<span>{$mv.unit}元</span>
						</td>
						<td class="button-wrap">
							<div>
								<input type="button" value="－" class="reduce" onclick="ajaxChange(<?php echo $mv['oldId']?>,<?php echo $mk+1?>,'-')">
								<input type="text" id="proCount{$mk+1}" class="pro-num" value="{$mv.count}">
								<input type="button" value="+" class="add" onclick="ajaxChange(<?php echo $mv['oldId']?>,<?php echo $mk+1?>,'+')">
							</div>
						</td>
						<td><span class="checkout-total" id="total{$mk+1}">{$mv.price}元</span></td>
						<td>
							<a href="javascript:;" class="delete">×</a>
							<input type="hidden" value="{$mv['oldId']}"  />
						</td>
					</tr>
				</foreach>
			</tbody>
		</table>
		
		<form action="{:U('Product/showCal')}" method="post">
		<div class="balance">
			<!-- <a href="{:U('Product/showCal')}">去结算</a> -->
			<input type="submit" value="去结算">
			<span>合计（不含运费）:<span id="allPrice">{$allPrice}.00</span>元</span>
		</div>
		</form>

		<h1>买购物车中商品的人还买了</h1>
		<foreach name="recommend" item="rv">
			<div class="pro-cart">
				<a href="javascript:;"><img src="__PUBLIC__/images/recommend{$rv.id}.jpg" alt=""></a><a href="javascript:;">{$rv.name}</a><p></p><span>{$rv.price}</span>
			</div>
		</foreach>
		<!--<div class="pro-cart">-->
				<!--<a href="javascript:;"><img src="__PUBLIC__/images/boximg2.jpg" alt=""></a><a href="javascript:;">九号平衡车</a><p>年轻人的酷玩具，骑行遥控两种玩法</p><span>1999元起</span>-->
		<!--</div>-->
		<!--<div class="pro-cart">-->
				<!--<a href="javascript:;"><img src="__PUBLIC__/images/boximg2.jpg" alt=""></a><a href="javascript:;">九号平衡车</a><p>年轻人的酷玩具，骑行遥控两种玩法</p><span>1999元起</span>-->
		<!--</div>-->
		<!--<div class="pro-cart">-->
			<!--<a href="javascript:;"><img src="__PUBLIC__/images/boximg2.jpg" alt=""></a><a href="javascript:;">九号平衡车</a><p>年轻人的酷玩具，骑行遥控两种玩法</p><span>1999元起</span>-->
		<!--</div>-->
		<!--<div class="pro-cart">-->
			<!--<a href="javascript:;"><img src="__PUBLIC__/images/boximg2.jpg" alt=""></a><a href="javascript:;">九号平衡车</a><p>年轻人的酷玩具，骑行遥控两种玩法</p><span>1999元起</span>-->
		<!--</div>-->
		<!--<div class="pro-cart">-->
			<!--<a href="javascript:;"><img src="__PUBLIC__/images/boximg2.jpg" alt=""></a><a href="javascript:;">九号平衡车</a><p>年轻人的酷玩具，骑行遥控两种玩法</p><span>1999元起</span>-->
		<!--</div>-->
		<!--<div class="pro-cart">-->
				<!--<a href="javascript:;"><img src="__PUBLIC__/images/boximg2.jpg" alt=""></a><a href="javascript:;">九号平衡车</a><p>年轻人的酷玩具，骑行遥控两种玩法</p><span>1999元起</span>-->
		<!--</div>-->
		<!--<div class="pro-cart">-->
				<!--<a href="javascript:;"><img src="__PUBLIC__/images/boximg2.jpg" alt=""></a><a href="javascript:;">九号平衡车</a><p>年轻人的酷玩具，骑行遥控两种玩法</p><span>1999元起</span>-->
		<!--</div>-->
		<!--<div class="pro-cart">-->
			<!--<a href="javascript:;"><img src="__PUBLIC__/images/boximg2.jpg" alt=""></a><a href="javascript:;">九号平衡车</a><p>年轻人的酷玩具，骑行遥控两种玩法</p><span>1999元起</span>-->
		<!--</div>-->
		<!--<div class="pro-cart">-->
			<!--<a href="javascript:;"><img src="__PUBLIC__/images/boximg2.jpg" alt=""></a><a href="javascript:;">九号平衡车</a><p>年轻人的酷玩具，骑行遥控两种玩法</p><span>1999元起</span>-->
		<!--</div>-->
		<!--<div class="pro-cart">-->
			<!--<a href="javascript:;"><img src="__PUBLIC__/images/boximg2.jpg" alt=""></a><a href="javascript:;">九号平衡车</a><p>年轻人的酷玩具，骑行遥控两种玩法</p><span>1999元起</span>-->
		<!--</div>-->
	</div>
	<div class="footer">
		<include file="Public/component/footer" />
	</div>
	<script type="text/javascript">
	$(function(){
		var reduce = $('.reduce');
		var add = $('.add');
		var pro_num = $('.pro-num');
		// add.click(function(){
		// 	var num_value = $(this).parent().find(':text').val();
		// 	num_value++;
		// 	$(this).parent().find(':text').val(num_value);
		// });
		// reduce.click(function(){
		// 	var num_value = $(this).parent().find(':text').val();
		// 	if(num_value >= 2){
		// 		num_value--;
		// 		$(this).parent().find(':text').val(num_value);
		// 	}
		// });
		$('.delete').click(function(){
			var oldId = $(this).next().val();
			var It = $(this);
			var validate=true;	
				$.ajax({	
					type: "POST",
					url: "Home/Product/delete_car?action=ajax",
					dataType: "json",	 
					
					data: {"oldId":oldId},
					
					beforeSend: function(){				
					},
					success: function(json){
						if(json.success==1){
							json.success=0;
							//到ajax里this已经变指了,提前存一下就能用了!!!
							It.parent().parent().fadeOut();
							validate=false;
						}else if(json.success==0){
							alert('删除失败！');
							validate=false;
						}else{
							alert("AjaxWrong!!");
						}
					}
			});
			if(!validate){
				return;
			}
		})
	});
	</script>
</body>
</html>